package com.service.business.order.controller.rep;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.service.business.product.controller.rep.ProductPayTypeRep;
import com.service.dao.model.OrderProductHrCombo;
import com.service.dao.model.OrderProductLockCombo;
import com.service.dao.model.OrderProductOther;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <dl>
 * <dt>back-end</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * <dd>Company: </dd>
 * <dd>CreateDate: 2019年11月14日</dd>
 * </dl>
 *
 * @author
 */
@Getter
@Setter
@ToString
public class BaseOrderLockRep {

	private String lockNo;

	private BigDecimal lockNum;

	private String lockMoneyCoin;

	private List<ProductPayTypeRep> payTypeList;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date orderTime;

	private Integer orderType;

	private Long overtime;

	private Map<String, BigDecimal> payMoneyMap;

	public static BaseOrderLockRep buildProductLockCombo(OrderProductLockCombo lockOrder, Long overtime) {
		BaseOrderLockRep result = new BaseOrderLockRep();
		result.setLockNo(lockOrder.getLockNo());
		result.setLockNum(lockOrder.getLockNum());
		result.setOrderTime(lockOrder.getCreateTime());
		result.setOrderType(lockOrder.getOrderType());
		result.setOvertime(overtime);
		return result;
	}

	public static BaseOrderLockRep buildProductLockCombo(OrderProductLockCombo lockOrder, Long overtime,
	                                                     List<ProductPayTypeRep> payTypeList) {
		BaseOrderLockRep result = new BaseOrderLockRep();
		result.setLockNo(lockOrder.getLockNo());
		result.setLockNum(lockOrder.getLockNum());
		result.setOrderTime(lockOrder.getCreateTime());
		result.setOrderType(lockOrder.getOrderType());
		result.setOvertime(overtime);
		result.setPayTypeList(payTypeList);
		result.setLockMoneyCoin(payTypeList.get(0).getPayTypeList().get(0).getCoinsName());
		return result;
	}


}
